home *** CD-ROM | disk | FTP | other *** search
Text File | 2005-04-04 | 3.4 KB | 129 lines | [TEXT/FB^e] |
- _isBeta = _zTrue
-
-
- /*
-
- to use this you will need to do 3 things:
-
- thing 1 - include this file.
-
- thing 2 - create a file named Beta.glbl and in it place a dummy
- constant like this: _betaTimeOut = 0 [this will be overwritten.]
-
- thing 3 - in should program, call...
-
- #if _isBeta
- long if system ( _aplFlag )
- long if fn checkBetaDate
- if fn StandardAlert(_kAlertNoteAlert, "beta expired", "xxx must now quit", 0, #0) then end else end
- end if
- xelse
- fn resetBetaDate
- end if
- #endif
-
- you might want to expand on the stop dialog to tell the user
- something more than 'beta expired'. perhaps you will tell them
- where to get a new beta.
-
- now *** RUN *** the file at least once. when you reopen the Beta.glbl
- file, you will see something like this...
-
-
- //file updated on 03/30/05 at 01:56:38
- _betaTimeOut = 0xBE9744D6// expires 4/29/05
- dim as str255 gBetaExpiration
- gBetaExpiration = "Expires 4/29/05"
-
- note that there is an extra global string here [gBetaExpiration] that you
- may use in an 'about' box to tell your user whne the beta will expire.
-
-
- how this works:
-
- each time you *run* your program during the testing cycle, it
- recreates the beta.glbl file with a new beta date that is 30 days
- beyond the current date. when the file is finally built, it will
- include an expiration date that is hard wired into the code that
- is 30 days from the last day that is used. this can't be changed
- by the user by switching some resource. it is hard-wired into the code.
-
- you check, at some point in your code, to see if the beta date has
- expired and make make an exit if it has. the check is a simple one.
-
- hasExpired = fn checkBetaDate
-
- if hasExpired is non zero then the 30 days has expired.
-
- if you want more or less than 30 days, change the 30 in fn resetBetaDate
- myDateTimeRec.day = myDateTimeRec.day + 30 <----------
-
- ------------------
-
- when you are ready to ship a final product, set _isBeta [above] to _false
- */
-
-
- #if _isBeta
-
- clear local
- local fn resetBetaDate
- '~'9
-
- dim myDateTimeRec as DateTimeRec
- dim @mySeconds as long
- dim as str255 sourceLine(2)
- dim betaString as str255
- dim fs as fsSpec
- dim err as OSErr
-
- long if _isBeta
-
- long if system(_aplFlag) = _false
- GetDateTime(mySeconds)
- SecondsToDate(mySeconds, myDateTimeRec)
- myDateTimeRec.day = myDateTimeRec.day + 30
- DateToSeconds (myDateTimeRec, mySeconds)
- DateString( mySeconds, _shortDate, betaString, fn GetIntlResource( 0 ) )
-
-
- sourceLine(0) = "_betaTimeOut = 0x"+hex$(mySeconds) + "// expires " + betaString
- sourceLine(1) = "dim as str255 gBetaExpiration"
- sourceLine(2) = "gBetaExpiration = " +chr$(34) + "Expires " +betaString +chr$(34)
-
-
- def open "TEXTFB^e"
- open "O",#1,"Beta.glbl",1,system(_aplVol)
- print #1,"//file updated on ";date$;" at "time$
- print #1,sourceLine(0)
- print #1,sourceLine(1)
- print #1,sourceLine(2)
- close #1
-
- end if
- end if
- end fn
-
- clear local
- local fn checkBetaDate
- '~'9
- dim @mySeconds as long
- dim result as word
-
- result = 0
- long if _isBeta
- long if system(_aplFlag)
- GetDateTime(mySeconds)
- long if (mySeconds >> 1) > (_betaTimeOut >> 1)
- result = _zTrue
- end if
- end if
- end if
-
-
-
- end fn = result
- #endif
-
-
-